home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / isconn_1 / module1.bas < prev    next >
Encoding:
BASIC Source File  |  1999-08-31  |  27.2 KB  |  999 lines

  1. Attribute VB_Name = "Module1"
  2. '***************************************
  3. '** Note converting page to html code is not
  4. 'my code but I it is already sent to planet source code
  5. 'by someone that i don't no his name,sorry because I can't
  6. 'credit him.
  7. '***************************************
  8. Public MyAgent As Object
  9. Public imagemax As Integer
  10. Public addctrl As String
  11. Public bgsound As String
  12. Public zoo As Integer
  13. Public textmax As Integer
  14. Public cmax As Integer
  15. Public ctrltype As String
  16. Public dirty As Boolean
  17. Public shapemax As Integer
  18. Public linemax As Integer
  19. Public changes As Boolean
  20. Public curfile As String
  21. Public tcde(100) As String
  22. Public icde(100) As String
  23. Public runtime As Boolean
  24. Public ccindexx As Integer
  25. Public indexctrl As Integer
  26. Public bgclr As OLE_COLOR
  27. Public lclr As OLE_COLOR
  28. Public vclr As OLE_COLOR
  29. Public tclr As OLE_COLOR
  30. Dim string1, string2
  31. Private localTable As table
  32. Private regionGroup() As region
  33. Private tableArray() As Double
  34. Private objectCounter As Integer
  35. Private Const xLevel As Integer = 0, yLevel As Integer = 1, objectLevel As Integer = 2, drawnLevel As Integer = 3
  36.  
  37.  
  38. Private Type table
  39.     Width As Integer
  40.     Height As Integer
  41.     cellsWide As Integer
  42.     cellsTall As Integer
  43.     bgcolor As String
  44.     html As String
  45.     cellPadding As Integer
  46.     End Type
  47.  
  48.  
  49. Private Type region
  50.     html As String
  51.     Left As Long
  52.     Top As Long
  53.     Width As Long
  54.     Height As Long
  55.     bgcolor As String
  56.     rowSpan As Long
  57.     colSpan As Long
  58.     End Type
  59.     '***************************************************
  60.     'end declarations
  61.     'start code
  62.     '***************************************************
  63.  
  64. Public Declare Function RasEnumConnections Lib "RasApi32.dll" Alias "RasEnumConnectionsA" (lpRasCon As Any, lpcb As Long, lpcConnections As Long) As Long
  65.  
  66.  
  67. Public Declare Function RasGetConnectStatus Lib "RasApi32.dll" Alias "RasGetConnectStatusA" (ByVal hRasCon As Long, lpStatus As Any) As Long
  68.     '
  69.     Public Const RAS95_MaxEntryName = 256
  70.     Public Const RAS95_MaxDeviceType = 16
  71.     Public Const RAS95_MaxDeviceName = 32
  72.     '
  73.  
  74.  
  75. Public Type RASCONN95
  76.     dwSize As Long
  77.     hRasCon As Long
  78.     szEntryName(RAS95_MaxEntryName) As Byte
  79.     szDeviceType(RAS95_MaxDeviceType) As Byte
  80.     szDeviceName(RAS95_MaxDeviceName) As Byte
  81.     End Type
  82.     '
  83.  
  84.  
  85. Public Type RASCONNSTATUS95
  86.     dwSize As Long
  87.     RasConnState As Long
  88.     dwError As Long
  89.     szDeviceType(RAS95_MaxDeviceType) As Byte
  90.     szDeviceName(RAS95_MaxDeviceName) As Byte
  91.     End Type
  92.  
  93. Public Function Render() As String
  94.  
  95.     PrepareCrap 'get the crap ready For this new situation.
  96.     MakeTable
  97.     ClearAllRegions
  98.     Render = localTable.html 'return the resulting html
  99. End Function
  100.  
  101.  
  102.  
  103. Public Function AddRegion(html As String, Left As Double, Top As Double, Width As Double, Height As Double, bgcolor As String)
  104.  
  105.     objectCounter = objectCounter + 1
  106.     ReDim Preserve regionGroup(objectCounter)
  107.     If html = "" Then html = " "
  108.     regionGroup(objectCounter - 1).html = html
  109.     regionGroup(objectCounter - 1).Left = Left
  110.     regionGroup(objectCounter - 1).Top = Top
  111.     regionGroup(objectCounter - 1).Width = Width
  112.     regionGroup(objectCounter - 1).Height = Height
  113.     If bgcolor <> "" Then
  114.     regionGroup(objectCounter - 1).bgcolor = bgcolor
  115. End If
  116. End Function
  117.  
  118.  
  119.  
  120. Private Function ClearAllRegions()
  121.  
  122.     objectCounter = 0
  123.     Erase regionGroup()
  124. End Function
  125.  
  126.  
  127.  
  128.  
  129. Private Sub PrepareCrap()
  130.  
  131.     Erase tableArray()
  132.     localTable.cellsWide = calculateCellsWide
  133.     localTable.cellsTall = calculateCellsTall
  134.     localTable.html = "" 'set html to nothing so that old rendering doesn't show up here
  135.     localTable.Width = 0
  136.     localTable.Height = 0
  137.     ReDim tableArray(localTable.cellsWide, localTable.cellsTall, 4) 'resize the tablearray table
  138.  
  139.  
  140.     For i = 0 To localTable.cellsWide
  141.  
  142.  
  143.         For j = 0 To localTable.cellsTall
  144.             tableArray(i, j, objectLevel) = -1
  145.         Next j
  146.  
  147.     Next i
  148.  
  149. End Sub
  150.  
  151.  
  152.  
  153. Private Sub SortX()
  154.  
  155.     Dim edgeCoordinate As Integer
  156.  
  157.  
  158.     For i = 0 To localTable.cellsWide - 1
  159.         edgeCoordinate = 9999
  160.  
  161.  
  162.         For j = 0 To (objectCounter - 1)
  163.  
  164.  
  165.             If (i = 0) Then
  166.  
  167.  
  168.                 If (regionGroup(j).Left < edgeCoordinate) Then
  169.                     edgeCoordinate = regionGroup(j).Left
  170.                 End If
  171.  
  172.             ElseIf ((regionGroup(j).Left < edgeCoordinate) And (regionGroup(j).Left > tableArray((i - 1), 0, xLevel))) Then
  173.                 edgeCoordinate = regionGroup(j).Left
  174.             End If
  175.  
  176.         Next j
  177.  
  178.  
  179.  
  180.         If (edgeCoordinate <> 9999) Then
  181.             If i = localTable.cellsWide Then Beep
  182.             tableArray(i, 0, xLevel) = edgeCoordinate
  183.         End If
  184.  
  185.     Next i
  186.  
  187. End Sub
  188.  
  189.  
  190.  
  191. Private Sub SortY()
  192.  
  193.     Dim edgeCoordinate As Integer
  194.  
  195.  
  196.     For i = 0 To localTable.cellsTall - 1
  197.         edgeCoordinate = 9999
  198.  
  199.  
  200.         For j = 0 To (objectCounter - 1)
  201.  
  202.  
  203.             If (i = 0) Then
  204.  
  205.  
  206.                 If (regionGroup(j).Top < edgeCoordinate) Then
  207.                     edgeCoordinate = regionGroup(j).Top
  208.                 End If
  209.  
  210.             ElseIf ((regionGroup(j).Top < edgeCoordinate) And (regionGroup(j).Top > tableArray(0, (i - 1), yLevel))) Then
  211.                 edgeCoordinate = regionGroup(j).Top
  212.             End If
  213.  
  214.         Next j
  215.  
  216.  
  217.  
  218.         If (edgeCoordinate <> 9999) Then
  219.             tableArray(0, i, yLevel) = edgeCoordinate
  220.         End If
  221.  
  222.     Next i
  223.  
  224. End Sub
  225.  
  226.  
  227.  
  228. Private Function LayoutTable()
  229.  
  230.     localTable.html = localTable.html & "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=" & localTable.cellPadding & " BGCOLOR=" & localTable.bgcolor & ">"
  231.  
  232.  
  233.     If tableArray(0, 0, yLevel) <> 0 Then 'only Do this if there is some height to give to the vertical offset
  234.         localTable.html = localTable.html & "<TR>" 'start the row
  235.  
  236.  
  237.         If (tableArray(0, 0, xLevel) <> 0) Then 'only print this first cell if there is some horizontal offset
  238.             localTable.html = localTable.html & "<TD>" & vbCrLf
  239.             localTable.html = localTable.html & "<IMG SRC=trans.gif HEIGHT=" & Chr(34) & tableArray(0, 0, yLevel) & Chr(34) & " WIDTH=" & Chr(34) & tableArray(0, 0, xLevel) & Chr(34) & ">"
  240.             localTable.html = localTable.html & "</TD>"
  241.         End If
  242.  
  243.         'for loop starts here,
  244.         'this needs to go through and make cells and clearGifs with the g
  245.         '     eneric height, and variable widths
  246.  
  247.  
  248.         For j = 0 To localTable.cellsWide - 1
  249.             localTable.html = localTable.html & "<TD>"
  250.             localTable.html = localTable.html & "<IMG SRC=trans.gif HEIGHT=" & Chr(34) & "1" & Chr(34)
  251.  
  252.  
  253.             If j < localTable.cellsWide - 1 Then
  254.                 localTable.html = localTable.html & " WIDTH=" & Chr(34) & (tableArray(j + 1, 0, xLevel) - tableArray(j, 0, xLevel)) & Chr(34) & ">"
  255.             Else
  256.                 localTable.html = localTable.html & " WIDTH=" & Chr(34) & (localTable.Width - tableArray(j, 0, xLevel)) & Chr(34) & ">"
  257.             End If
  258.  
  259.             localTable.html = localTable.html & "</TD>"
  260.         Next j
  261.  
  262.         localTable.html = localTable.html & "</TR>"
  263.     End If
  264.  
  265.  
  266.  
  267.     For i = 0 To localTable.cellsTall - 1
  268.         localTable.html = localTable.html & "<TR>"
  269.  
  270.  
  271.         For j = 0 To localTable.cellsWide - 1
  272.  
  273.  
  274.             If ((tableArray(j, 0, xLevel) <> 0) And (j = 0)) Then 'only Do this is there is a horizontal width in the very first cell of the whole table
  275.                 localTable.html = localTable.html & "<TD>"
  276.              
  277.                 localTable.html = localTable.html & "<IMG SRC=trans.gif WIDTH=" & Chr(34) & "1" & Chr(34) 'print that width
  278.  
  279.  
  280.                 If i < localTable.cellsTall - 1 Then
  281.                     'here it is
  282.                     localTable.html = localTable.html & " HEIGHT=" & Chr(34) & Abs(tableArray(0, i + 1, yLevel) - tableArray(0, i, yLevel)) & Chr(34) & ">"
  283.                 Else
  284.                     localTable.html = localTable.html & " HEIGHT=" & Chr(34) & Abs(localTable.Height - tableArray(0, i, yLevel)) & Chr(34) & ">"
  285.                 End If
  286.  
  287.                 localTable.html = localTable.html & "</TD>"
  288.             End If
  289.  
  290.  
  291.  
  292.             If tableArray(j, i, objectLevel) <> -1 Then
  293.                 localTable.html = localTable.html & "<TD VALIGN=TOP "
  294.  
  295.  
  296.                 If regionGroup((tableArray(j, i, objectLevel))).colSpan > 1 Then
  297.                     localTable.html = localTable.html & "COLSPAN=" & regionGroup(tableArray(j, i, objectLevel)).colSpan & " "
  298.                 End If
  299.  
  300.  
  301.  
  302.                 If regionGroup(tableArray(j, i, objectLevel)).rowSpan > 1 Then
  303.                     localTable.html = localTable.html & "ROWSPAN=" & regionGroup(tableArray(j, i, objectLevel)).rowSpan
  304.                 End If
  305.  
  306.                 localTable.html = localTable.html & "><table valign=top align=left border=0 cellspacing=0 cellpadding=0 width=" & regionGroup(tableArray(j, i, objectLevel)).Width & " height=" & regionGroup(tableArray(j, i, objectLevel)).Height & " "
  307.  
  308.  
  309.                 If regionGroup(tableArray(j, i, objectLevel)).bgcolor <> "" Then
  310.                     localTable.html = localTable.html & "bgcolor=" & regionGroup(tableArray(j, i, objectLevel)).bgcolor
  311.                 End If
  312.  
  313.                 localTable.html = localTable.html & "><tr><td>"
  314.                 'here is where the actual object placement occurs
  315.                 localTable.html = localTable.html & regionGroup(tableArray(j, i, objectLevel)).html
  316.                 'here is where the actual object placement occurs
  317.                 localTable.html = localTable.html & "</td></tr></table></TD>"
  318.             ElseIf ((tableArray(j, i, drawnLevel) <> 1) And (tableArray(j, i, objectLevel) = -1)) Then
  319.                 localTable.html = localTable.html & "<TD>"
  320.                 localTable.html = localTable.html & "</TD>"
  321.             End If
  322.  
  323.         Next j
  324.  
  325.         localTable.html = localTable.html & "</TR>"
  326.     Next i
  327.  
  328.     localTable.html = localTable.html & "</table>"
  329.  
  330. End Function
  331.  
  332.  
  333.  
  334. Private Sub FindTableDimensions()
  335.  
  336.  
  337.  
  338.     For i = 0 To objectCounter - 1
  339.  
  340.  
  341.         If ((regionGroup(i).Left + regionGroup(i).Width) > localTable.Width) Then
  342.             localTable.Width = regionGroup(i).Left + regionGroup(i).Width
  343.         End If
  344.  
  345.  
  346.  
  347.         If ((regionGroup(i).Top + regionGroup(i).Height) > localTable.Height) Then
  348.             localTable.Height = regionGroup(i).Top + regionGroup(i).Height
  349.         End If
  350.  
  351.     Next i
  352.  
  353.     'everything looks good this far
  354. End Sub
  355.  
  356.  
  357.  
  358. Private Function MakeTable()
  359.  
  360.     FindTableDimensions
  361.     SortX 'put the sides (in one dimension) in order smallest to largest
  362.     SortY
  363.     'I think this last step went right, but maybe not
  364.     'the problem seems to only show when using objects positioned at
  365.     '     a 0 on an axis
  366.     assignObjects 'mark objects as being in certain cells, and their spans
  367.     LayoutTable
  368. End Function
  369.  
  370.  
  371.  
  372. Private Sub assignObjects()
  373.  
  374.  
  375.  
  376.     For Y = 0 To localTable.cellsWide - 1
  377.  
  378.  
  379.         For j = 0 To localTable.cellsTall - 1
  380.             Dim k As Integer
  381.             k = 0
  382.  
  383.  
  384.             For k = 0 To objectCounter - 1
  385.  
  386.  
  387.                 If ((tableArray(Y, 0, xLevel) = regionGroup(k).Left) And (tableArray(0, j, yLevel) = regionGroup(k).Top)) Then
  388.                     tableArray(Y, j, objectLevel) = k
  389.  
  390.  
  391.                     doIt Int(Y), Int(j), Int(k)
  392.                     End If
  393.  
  394.                 Next k
  395.  
  396.             Next j
  397.  
  398.         Next Y
  399.  
  400.     End Sub
  401.  
  402.  
  403.  
  404. Private Sub doIt(cellXpos As Integer, cellYpos As Integer, objectNum As Integer)
  405.  
  406.     Dim rightNum As Integer, bottomNum As Integer
  407.     rightNum = (regionGroup(objectNum).Left + regionGroup(objectNum).Width)
  408.     bottomNum = (regionGroup(objectNum).Top + regionGroup(objectNum).Height)
  409.  
  410.  
  411.     For i = cellXpos To localTable.cellsWide - 1
  412.  
  413.  
  414.         If (tableArray(i, 0, xLevel) < rightNum) Then
  415.             regionGroup(objectNum).colSpan = regionGroup(objectNum).colSpan + 1
  416.         End If
  417.  
  418.  
  419.  
  420.         For j = cellYpos To localTable.cellsTall - 1
  421.  
  422.  
  423.             If i = cellXpos Then
  424.  
  425.  
  426.                 If (tableArray(0, j, yLevel) < bottomNum) Then
  427.                     regionGroup(objectNum).rowSpan = regionGroup(objectNum).rowSpan + 1
  428.                 End If
  429.  
  430.             End If
  431.  
  432.  
  433.  
  434.             If ((tableArray(0, j, yLevel) < bottomNum) And (tableArray(i, 0, xLevel) < rightNum)) Then
  435.                 tableArray(i, j, drawnLevel) = 1
  436.             End If
  437.  
  438.         Next j
  439.  
  440.     Next i
  441.  
  442. End Sub
  443.  
  444.  
  445.  
  446. Private Function calculateCellsWide() As Integer
  447.  
  448.     Dim duplicateEdges As Integer
  449.  
  450.  
  451.     For i = 0 To (objectCounter - 1)
  452.  
  453.  
  454.         For j = i To (objectCounter - 1)
  455.  
  456.  
  457.             If ((regionGroup(i).Left = regionGroup(j).Left) And (i <> j)) Then
  458.                 duplicateEdges = duplicateEdges + 1
  459.                 j = objectCounter + 4
  460.             End If
  461.  
  462.         Next j
  463.  
  464.  
  465.  
  466.         If (regionGroup(i).Left = 0) Then
  467.             duplicateEdges = duplicateEdges - 1
  468.         End If
  469.  
  470.     Next i
  471.  
  472.     calculateCellsWide = (objectCounter - duplicateEdges)
  473. End Function
  474.  
  475.  
  476.  
  477. Private Function calculateCellsTall() As Integer
  478.  
  479.     Dim duplicateEdges As Integer
  480.  
  481.  
  482.     For i = 0 To (objectCounter - 1)
  483.  
  484.  
  485.         For j = i To (objectCounter - 1)
  486.  
  487.  
  488.             If ((regionGroup(i).Top = regionGroup(j).Top) And (i <> j)) Then
  489.                 duplicateEdges = duplicateEdges + 1
  490.                 j = objectCounter + 4
  491.             End If
  492.  
  493.         Next j
  494.  
  495.  
  496.  
  497.         If (regionGroup(i).Top = 0) Then
  498.             duplicateEdges = duplicateEdges - 1
  499.         End If
  500.  
  501.     Next i
  502.  
  503.     calculateCellsTall = (objectCounter - duplicateEdges)
  504. End Function
  505. Sub savehtml(filename As String)
  506. Dim i As Integer
  507. Dim html As String
  508. Dim no As Integer
  509. Dim al As String
  510. Dim clr As String
  511. Dim btu As String
  512. Dim ebtu As String
  513. Dim str1 As String
  514. Dim str3 As String
  515. Dim str4 As String
  516. Dim hcode As String
  517. Dim str2 As String
  518. no = FreeFile
  519. Form1.ScaleMode = 3
  520. ClearAllRegions
  521.  
  522. Open filename For Output As #no
  523.  
  524. For i = 0 To Form1.Controls.Count - 1
  525. btu = ""
  526. ebtu = ""
  527. If TypeOf Form1.Controls(i) Is Image Then
  528. If Form1.Controls(i).Index <> 0 Then
  529.  
  530. str2 = Form1.Controls(i).Tag
  531. If str2 = "" Then
  532. hcode = "<img src = '" & Form1.Controls(i).ToolTipText & "' width='" & Form1.Controls(i).Width & "' height='" & Form1.Controls(i).Height & "'>"
  533. Else
  534. hcode = "<a href='" & str2 & "'><img src = '" & Form1.Controls(i).ToolTipText & "' width='" & Form1.Controls(i).Width & "' height='" & Form1.Controls(i).Height & "'></a>"
  535. End If
  536. AddRegion hcode, Form1.Controls(i).Left, Form1.Controls(i).Top, Form1.Controls(i).Width, Form1.Controls(i).Height, ""
  537. End If
  538. End If
  539. If TypeOf Form1.Controls(i) Is Label Then
  540.  
  541. If Form1.Controls(i).Index <> 0 Then
  542. If Form1.Controls(i).ToolTipText = "Text" Then
  543. Select Case Form1.Controls(i).Alignment
  544. Case 0: al = "left"
  545. Case 1: al = "right"
  546. Case 2: al = "center"
  547. End Select
  548. If Form1.Controls(i).FontBold = True Then
  549. btu = btu + "<strong>"
  550. ebtu = ebtu + "</strong>"
  551. End If
  552. If Form1.Controls(i).FontItalic = True Then
  553. btu = btu + "<em>"
  554. ebtu = ebtu + "</em>"
  555. End If
  556. If Form1.Controls(i).FontUnderline = True Then
  557. btu = btu + "<u>"
  558. ebtu = ebtu + "</u>"
  559. End If
  560. clr = gethcolor(Form1.Controls(i).ForeColor)
  561. If Form1.Controls(i).Tag = "" Then
  562. hcode = "<p align=""" & al & """><font color=""" & clr & """ size=""" & Form1.Controls(i).FontSize / 3 & """face=""" & Form1.Controls(i).FontName & """>" & btu & Form1.Controls(i).Caption & ebtu & "</font></p>"
  563. Else
  564. hcode = "<a href='" & Form1.Controls(i).Tag & "'><p align=""" & al & """><font color=""" & clr & """ size=""" & Form1.Controls(i).FontSize / 3 & """face=""" & Form1.Controls(i).FontName & """>" & btu & Form1.Controls(i).Caption & ebtu & "</font></p></a>"
  565. End If
  566. If Form1.Controls(i).BackStyle = 0 Then
  567. AddRegion hcode, Form1.Controls(i).Left, Form1.Controls(i).Top, Form1.Controls(i).Width, Form1.Controls(i).Height, ""
  568. Else
  569. clr = gethcolor(Form1.Controls(i).BackColor)
  570. AddRegion hcode, Form1.Controls(i).Left, Form1.Controls(i).Top, Form1.Controls(i).Width, Form1.Controls(i).Height, clr
  571. End If
  572. End If
  573. If Form1.Controls(i).ToolTipText = "Line" Then
  574. clr = gethcolor(Form1.Controls(i).BackColor)
  575. hcode = "<hr size='" & Form1.Controls(i).Height & "'color='" & clr & "'>"
  576. AddRegion hcode, Form1.Controls(i).Left, Form1.Controls(i).Top, Form1.Controls(i).Width, Form1.Controls(i).Height, ""
  577. End If
  578. If Form1.Controls(i).ToolTipText = "Html code" Then
  579. hcode = Form1.Controls(i).Tag
  580. AddRegion hcode, Form1.Controls(i).Left, Form1.Controls(i).Top, Form1.Controls(i).Width, Form1.Controls(i).Height, ""
  581. End If
  582. End If
  583. End If
  584.  
  585. Next i
  586. str1 = gethcolor(bgclr)
  587. str2 = gethcolor(vclr)
  588. str3 = gethcolor(tclr)
  589. str4 = gethcolor(lclr)
  590. Print #no, "<body background='" & MDI.Picture11.Tag & "' bgcolor='" & str1 & "' vlink='" & str2 & "' text='" & str3 & "' link='" & str4 & "'></body>"
  591. Print #no, "<bgsound src='" & bgsound & "' loop='infinite'>"
  592. Print #no, "<title>" & Form1.Tag & "</title>"
  593. Print #no, Render
  594. Close #no
  595. Form1.ScaleMode = 1
  596. End Sub
  597.  
  598.  
  599. Sub Savepage(filename As String)
  600. 'On Error Resume Next
  601. Dim no As Integer
  602. Dim i As Integer
  603. no = FreeFile
  604. 'Unload Form2
  605.  
  606. Open filename For Output As #no
  607. Print #no, "Page setup"
  608. Write #no, Form1.Width
  609. Write #no, Form1.Height
  610. Write #no, MDI.Picture11.Tag
  611. Write #no, Form1.Tag
  612. Write #no, bgclr
  613. Write #no, vclr
  614. Write #no, tclr
  615. Write #no, "none"
  616. Write #no, bgsound
  617. Write #no, lclr
  618. Write #no, "none"
  619. Write #no, "none"
  620. Write #no, "none"
  621. Write #no, "none"
  622. Write #no, "none"
  623. Write #no, "none"
  624. Write #no, "none"
  625. For i = 0 To Form1.Controls.Count - 1
  626. If Not TypeOf Form1.Controls(i) Is PictureBox Then
  627. If TypeOf Form1.Controls(i) Is Label And Form1.Controls(i).Index <> 0 Then
  628. If Form1.Controls(i).ToolTipText = "Text" Then
  629. Write #no, "Label"
  630. Write #no, Form1.Controls(i).Caption
  631. Write #no, Form1.Controls(i).Width
  632. Write #no, Form1.Controls(i).Height
  633. Write #no, Form1.Controls(i).Left
  634. Write #no, Form1.Controls(i).Top
  635. Write #no, Form1.Controls(i).BackColor
  636. Write #no, Form1.Controls(i).ForeColor
  637. Write #no, Form1.Controls(i).BackStyle
  638. Write #no, Form1.Controls(i).FontName
  639. Write #no, Form1.Controls(i).FontSize
  640. Write #no, Form1.Controls(i).FontBold
  641. Write #no, Form1.Controls(i).FontUnderline
  642. Write #no, Form1.Controls(i).FontItalic
  643. Write #no, Form1.Controls(i).Alignment
  644. Write #no, tcde(Form1.Controls(i).Index)
  645. Write #no, Form1.Controls(i).Tag
  646. Write #no, Form1.Controls(i).ToolTipText
  647. End If
  648. If Form1.Controls(i).ToolTipText = "Html code" Then
  649. Write #no, "Label"
  650. Write #no, Form1.Controls(i).Caption
  651. Write #no, Form1.Controls(i).Width
  652. Write #no, Form1.Controls(i).Height
  653. Write #no, Form1.Controls(i).Left
  654. Write #no, Form1.Controls(i).Top
  655. Write #no, Form1.Controls(i).BackColor
  656. Write #no, Form1.Controls(i).ForeColor
  657. Write #no, Form1.Controls(i).BackStyle
  658. Write #no, Form1.Controls(i).FontName
  659. Write #no, Form1.Controls(i).FontSize
  660. Write #no, Form1.Controls(i).FontBold
  661. Write #no, Form1.Controls(i).FontUnderline
  662. Write #no, Form1.Controls(i).FontItalic
  663. Write #no, Form1.Controls(i).Alignment
  664. Write #no, tcde(Form1.Controls(i).Index)
  665. Write #no, Form1.Controls(i).Tag
  666. Write #no, Form1.Controls(i).ToolTipText
  667. End If
  668. If Form1.Controls(i).ToolTipText = "Line" Then
  669. Write #no, "Label"
  670. Write #no, Form1.Controls(i).Caption
  671. Write #no, Form1.Controls(i).Width
  672. Write #no, Form1.Controls(i).Height
  673. Write #no, Form1.Controls(i).Left
  674. Write #no, Form1.Controls(i).Top
  675. Write #no, Form1.Controls(i).BackColor
  676. Write #no, Form1.Controls(i).ForeColor
  677. Write #no, Form1.Controls(i).BackStyle
  678. Write #no, Form1.Controls(i).FontName
  679. Write #no, Form1.Controls(i).FontSize
  680. Write #no, Form1.Controls(i).FontBold
  681. Write #no, Form1.Controls(i).FontUnderline
  682. Write #no, Form1.Controls(i).FontItalic
  683. Write #no, Form1.Controls(i).Alignment
  684. Write #no, tcde(Form1.Controls(i).Index)
  685. Write #no, Form1.Controls(i).Tag
  686. Write #no, Form1.Controls(i).ToolTipText
  687. End If
  688. End If
  689. If TypeOf Form1.Controls(i) Is Shape And Form1.Controls(i).Index <> 0 Then
  690. Write #no, "Shape"
  691. Write #no, Form1.Controls(i).Shape
  692. Write #no, Form1.Controls(i).Width
  693. Write #no, Form1.Controls(i).Height
  694. Write #no, Form1.Controls(i).Left
  695. Write #no, Form1.Controls(i).Top
  696. Write #no, Form1.Controls(i).BackColor
  697. Write #no, Form1.Controls(i).BorderColor
  698. Write #no, Form1.Controls(i).BackStyle
  699. Write #no, Form1.Controls(i).BorderStyle
  700. Write #no, Form1.Controls(i).BorderWidth
  701. Write #no, "none"
  702. Write #no, "none"
  703. Write #no, "none"
  704. Write #no, "none"
  705. Write #no, "none"
  706. Write #no, "none"
  707. Write #no, Form1.Controls(i).Tag
  708. End If
  709. If TypeOf Form1.Controls(i) Is Image And Form1.Controls(i).Index <> 0 Then
  710. Write #no, "Image"
  711. Write #no, Form1.Controls(i).Width
  712. Write #no, Form1.Controls(i).Height
  713. Write #no, Form1.Controls(i).Left
  714. Write #no, Form1.Controls(i).Top
  715. Write #no, Form1.Controls(i).ToolTipText
  716. Write #no, "none"
  717. Write #no, "none"
  718. Write #no, "none"
  719. Write #no, "none"
  720. Write #no, "none"
  721. Write #no, "none"
  722. Write #no, "none"
  723. Write #no, "none"
  724. Write #no, "none"
  725. Write #no, "none"
  726. Write #no, icde(Form1.Controls(i).Index)
  727. Write #no, Form1.Controls(i).Tag
  728. End If
  729. End If
  730. Next i
  731. Close #no
  732.  
  733. End Sub
  734.  
  735. Sub Openpage(filename As String)
  736. On Error Resume Next
  737. Unload Form2
  738. Form2.Show
  739. Form2.Hide
  740. imagemax = 0
  741. textmax = 0
  742. cmax = 0
  743. shapemax = 0
  744. linemax = 0
  745. Dim no As Integer
  746. Dim i As Integer
  747.  
  748. no = FreeFile
  749. Open filename For Input As #no
  750. Do
  751. Input #no, a
  752. Input #no, b
  753. Input #no, c
  754. Input #no, d
  755. Input #no, e
  756. Input #no, f
  757. Input #no, g
  758. Input #no, h
  759. Input #no, i
  760. Input #no, j
  761. Input #no, k
  762. Input #no, l
  763. Input #no, m
  764. Input #no, n
  765. Input #no, o
  766. Input #no, p
  767. Input #no, Q
  768. Input #no, r
  769. If a = "Page setup" Then
  770. Form1.Width = b
  771. Form1.Height = c
  772. MDI.Picture11.Tag = d
  773. MDI.Picture11.Picture = LoadPicture(d)
  774. Form1.Tag = e
  775. bgclr = f
  776. Form1.BackColor = bgclr
  777. vclr = g
  778. tclr = h
  779. bgsound = j
  780. lclr = k
  781. End If
  782. If a = "Label" Then
  783. If r = "Text" Then
  784. textmax = textmax + 1
  785. Load Form1.Label1(textmax)
  786. Form1.Label1(textmax).Caption = b
  787. Form1.Label1(textmax).Width = c
  788. Form1.Label1(textmax).Height = d
  789. Form1.Label1(textmax).Left = e
  790. Form1.Label1(textmax).Top = f
  791. Form1.Label1(textmax).BackStyle = i
  792. Form1.Label1(textmax).BackColor = g
  793. Form1.Label1(textmax).ForeColor = h
  794. Form1.Label1(textmax).FontName = j
  795. Form1.Label1(textmax).FontSize = k
  796. Form1.Label1(textmax).FontBold = l
  797. Form1.Label1(textmax).FontUnderline = m
  798. Form1.Label1(textmax).FontItalic = n
  799. Form1.Label1(textmax).Alignment = o
  800. Form1.Label1(textmax).Tag = Q
  801. Form1.Label1(textmax).ToolTipText = r
  802. Form1.Label1(textmax).ZOrder 0
  803. tcde(textmax) = p
  804. Form1.Label1(textmax).Visible = True
  805. textmax = textmax + 1
  806. End If
  807. If r = "Line" Then
  808. linemax = linemax + 1
  809. Load Form1.Label2(linemax)
  810. Form1.Label2(linemax).Caption = b
  811. Form1.Label2(linemax).Width = c
  812. Form1.Label2(linemax).Height = d
  813. Form1.Label2(linemax).Left = e
  814. Form1.Label2(linemax).Top = f
  815. Form1.Label2(linemax).BackStyle = i
  816. Form1.Label2(linemax).BackColor = g
  817. Form1.Label2(linemax).ForeColor = h
  818. Form1.Label2(linemax).FontName = j
  819. Form1.Label2(linemax).FontSize = k
  820. Form1.Label2(linemax).FontBold = l
  821. Form1.Label2(linemax).FontUnderline = m
  822. Form1.Label2(linemax).FontItalic = n
  823. Form1.Label2(linemax).Alignment = o
  824. Form1.Label2(linemax).ToolTipText = r
  825. Form1.Label2(linemax).Tag = Q
  826. Form1.Label2(linemax).ZOrder 0
  827. Form1.Label2(linemax).Visible = True
  828. linemax = linemax + 1
  829. End If
  830. If r = "Html code" Then
  831. cmax = cmax + 1
  832. Load Form1.Label3(cmax)
  833. Form1.Label3(cmax).Caption = b
  834. Form1.Label3(cmax).Width = c
  835. Form1.Label3(cmax).Height = d
  836. Form1.Label3(cmax).Left = e
  837. Form1.Label3(cmax).Top = f
  838. Form1.Label3(cmax).BackStyle = i
  839. Form1.Label3(cmax).BackColor = g
  840. Form1.Label3(cmax).ForeColor = h
  841. Form1.Label3(cmax).FontName = j
  842. Form1.Label3(cmax).FontSize = k
  843. Form1.Label3(cmax).FontBold = l
  844. Form1.Label3(cmax).FontUnderline = m
  845. Form1.Label3(cmax).FontItalic = n
  846. Form1.Label3(cmax).Alignment = o
  847. Form1.Label3(cmax).ToolTipText = r
  848. Form1.Label3(cmax).Tag = Q
  849. Form1.Label3(cmax).ZOrder 0
  850. Form1.Label3(cmax).Visible = True
  851. cmax = cmax + 1
  852. End If
  853. End If
  854.  
  855. If a = "Shape" Then
  856. shapemax = shapemax + 1
  857. Load Form1.Shape1(shapemax)
  858. Form1.Shape1(shapemax).Shape = b
  859. Form1.Shape1(shapemax).Width = c
  860. Form1.Shape1(shapemax).Height = d
  861. Form1.Shape1(shapemax).Left = e
  862. Form1.Shape1(shapemax).Top = f
  863. Form1.Shape1(shapemax).BackStyle = i
  864. Form1.Shape1(shapemax).BackColor = g
  865. Form1.Shape1(shapemax).BorderColor = h
  866. Form1.Shape1(shapemax).BorderStyle = j
  867. Form1.Shape1(shapemax).BorderWidth = k
  868. Form1.Shape1(shapemax).Visible = True
  869. shapemax = shapemax + 1
  870. End If
  871.  
  872. If a = "Image" Then
  873. imagemax = imagemax + 1
  874. Load Form1.Image1(imagemax)
  875. Form1.Image1(imagemax).Width = b
  876. Form1.Image1(imagemax).Height = c
  877. Form1.Image1(imagemax).Left = d
  878. Form1.Image1(imagemax).Top = e
  879. Form1.Image1(imagemax).ToolTipText = f
  880. Form1.Image1(imagemax).Stretch = True
  881. Form1.Image1(imagemax).Visible = True
  882. Form1.Image1(imagemax).Picture = LoadPicture(f)
  883. Form1.Image1(imagemax).Tag = r
  884. Form1.Image1(imagemax).ZOrder 0
  885. icde(imagemax) = p
  886. imagemax = imagemax + 1
  887. End If
  888.  
  889.  
  890. Loop Until EOF(no)
  891. Close #no
  892. End Sub
  893. Sub dec(filename As String)
  894.  
  895. Dim Message As String
  896. Dim TryPass As String
  897. Dim charnum As Currency, randominteger As Currency
  898. Dim singlechar As String * 1
  899. Dim keyvalue As Currency
  900. Dim secondkey As Currency
  901. Dim CurrChar As String
  902. Dim msg As String
  903. Dim ctxt As Integer
  904. Dim filenum As Currency
  905. Dim X As Currency
  906. Dim i As Currency
  907. filenum = FreeFile
  908.  filename$ = filename
  909. Open filename$ For Binary As #filenum
  910.     For i = 1 To LOF(filenum)
  911.       Get #filenum, i, singlechar
  912.       charnum = Asc(singlechar)
  913.       randominteger = Int(256 * Rnd)
  914.       charnum = charnum Xor randominteger
  915.       singlechar = Chr$(charnum)
  916.       Put #filenum, i, singlechar
  917.     Next i
  918.   Close #filenum
  919. End Sub
  920. Sub krypt(filename)
  921. Dim Message As String
  922. Dim TryPass As String
  923. Dim charnum As Currency, randominteger As Currency
  924. Dim singlechar As String * 1
  925. Dim keyvalue As Currency
  926. Dim secondkey As Currency
  927. Dim CurrChar As String
  928. Dim msg As String
  929. Dim ctxt As Integer
  930. Dim Q As Currency
  931. Dim filenum As Currency
  932. Dim X As Currency
  933. Dim i As Currency
  934. Dim xx As Currency
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.     filenum = FreeFile
  948.     X = Rnd(-keyvalue)
  949.     
  950.  
  951.     
  952.    
  953.  
  954.     Open filename For Binary As #filenum     'open the file name for output/input.
  955.     For i = 1 To LOF(filenum)
  956.       Get #filenum, i, singlechar
  957.       charnum = Asc(singlechar)
  958.       randominteger = Int(256 * Rnd)
  959.       charnum = charnum Xor randominteger
  960.       singlechar = Chr$(charnum)
  961.       Put #filenum, i, singlechar
  962.     Next i
  963.   Close #filenum
  964. End Sub
  965. Function getcommand(searchin As String) As String
  966. On Error Resume Next
  967. Dim n As Integer, s As String
  968.  
  969. n = InStr(1, searchin, ",", vbTextCompare)
  970. s = Mid(searchin, 1, n - 1)
  971. s = Format(s, ">")
  972. getcommand = s
  973. End Function
  974.  
  975. Function getval(searchin As String) As String
  976. On Error Resume Next
  977. Dim n As Integer, s As String
  978. n = InStr(1, searchin, ",", vbTextCompare)
  979. X = Len(searchin)
  980. s = Mid(searchin, n + 1, X - 1)
  981. getval = s
  982. End Function
  983.  
  984. Function gethcolor(colorlong As Long) As String
  985. On Error Resume Next
  986. Dim Red As Long, Green As Long, Blue As Long
  987.  
  988. Red = colorlong And &HFF&
  989. Green = (colorlong And &HFF00&) \ 256
  990. Blue = (colorlong And &HFF0000) \ 65536
  991. gethcolor = "#" + Hex(Red) + Hex(Green) + Hex(Blue)
  992.  
  993.  
  994.     If gethcolor = "#000" Then
  995.          gethcolor = "#000000"
  996.     End If
  997.  
  998. End Function
  999.